Skip to content

common_variant_classified_task: don't raise IntegrityError when run twice (#2948) - #2949

Open
davmlaw wants to merge 1 commit into
masterfrom
2948_common_variant_classified_idempotent
Open

davmlaw wants to merge 1 commit into
masterfrom
2948_common_variant_classified_idempotent

Conversation

@davmlaw

@davmlaw davmlaw commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🤖 Written by Claude

#2948

A (variant, common filter) can be queued more than once before its first task creates the CommonVariantClassified, because the duplicate check only runs when tasks are queued. The duplicates have nothing left to do but raised IntegrityError on the final create, which is what is filling the error logs. No data was affected.

common_variant_classified_task is now idempotent:

  • returns early if the CommonVariantClassified already exists (the common case: duplicates run one after another)
  • the insert into the uncommon partition is ON CONFLICT DO NOTHING, so a duplicate overlapping the first one finishes the move (removing the common row) instead of erroring on the partition's unique (collection, variant) index
  • the row is created with get_or_create

Tests: two new tests in snpdb/tests/test_cohort_genotype.py (task run twice; genotype already in uncommon but still in common). Both fail on master with the two IntegrityErrors and pass here; snpdb.tests.test_cohort_genotype passes.

🤖 Generated with Claude Code

…before its first task created the CommonVariantClassified returns early, an overlapping duplicate's insert into the uncommon partition is ON CONFLICT DO NOTHING, and the row is get_or_create, so duplicates no longer raise IntegrityError #2948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant